Skip to content

feat: support objects in remaining dot array helpers#10269

Closed
syawqy wants to merge 1 commit into
codeigniter4:4.8from
syawqy:feat-dot-array-object-followup
Closed

feat: support objects in remaining dot array helpers#10269
syawqy wants to merge 1 commit into
codeigniter4:4.8from
syawqy:feat-dot-array-object-followup

Conversation

@syawqy

@syawqy syawqy commented Jun 2, 2026

Copy link
Copy Markdown

Description
This is a follow-up to PR #10226, which added object support to dot_array_search() and array_group_by().

This PR extends the same object-read support to the remaining read-style dot array helpers:

  • dot_array_has()
  • dot_array_only()
  • dot_array_except()

The implementation reuses the existing object access patterns already introduced for PR #10226:

  • valueExists()
  • value()
  • entityToArray()
  • toIterable()

Objects are handled for bounded key/property lookups and wildcard traversal, including Entity, ArrayObject, public object properties, and magic __isset() / __get() access. Entity wildcard traversal continues to use toArray() so internal properties are not exposed.

dot_array_set() and dot_array_unset() remain array-only because they are mutating helpers.

Docs and the v4.8.0 changelog were updated to reflect the expanded object support.

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@mergeable

mergeable Bot commented Jun 2, 2026

Copy link
Copy Markdown

Hi there, syawqy! 👋

Thank you for sending this PR!

We expect the following in all Pull Requests (PRs).

Important

We expect all code changes or bug-fixes to be accompanied by one or more tests added to our test suite to prove the code works.

If pull requests do not comply with the above, they will likely be closed. Since we are a team of volunteers, we don't have any more time to work
on the framework than you do. Please make it as painless for your contributions to be included as possible.

See https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/pull_request.md

Sincerely, the mergeable bot 🤖

@github-actions github-actions Bot added the 4.8 PRs that target the `4.8` branch. label Jun 2, 2026
@michalsn

michalsn commented Jun 9, 2026

Copy link
Copy Markdown
Member

I had quite a few suggestions, so I thought it would be clearer to open a separate PR: #10296. It is based on your work, so you are still included as a co-author.

@syawqy

syawqy commented Jun 10, 2026

Copy link
Copy Markdown
Author

Thank you so much, @michalsn! 🙏

I really appreciate you taking the time to extend this instead of just leaving review notes, #10296 covers far more
ground than my original PR, and unifying the lookup path for arrays and objects is a much cleaner approach than what I
had. The handling around preserving keys for traversable objects and only converting the selected/removed parts to
arrays is exactly the kind of nuance I missed.

Thanks as well for keeping me as a co-author. I'll go ahead and close this one in favor of #10296. Happy to help test
or review there if it's useful.

@michalsn

Copy link
Copy Markdown
Member

@syawqy Reviews are always welcome, thanks!

@syawqy syawqy closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4.8 PRs that target the `4.8` branch.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants